<?php
	require_once $_SERVER['DOCUMENT_ROOT'] . '/SAGER/utilities/xajax/xajax_core/xajax.inc.php';
    require_once $_SERVER['DOCUMENT_ROOT'] . '/SAGER/gui/presenter/PresenterPayInstallation.php';
	require_once $_SERVER['DOCUMENT_ROOT'] . '/SAGER/FirePHPCore-0.3.2/lib/FirePHPCore/FirePHP.class.php';
		
	$debug = FirePHP :: getInstance(true);
	$debug -> setEnabled(true);
	
	//Permite eliminar los notices
	error_reporting (E_ALL ^ E_NOTICE);
	
	$_SESSION['debug'] = $debug;
	
	$xajax = new xajax(); 
	 
	$xajax -> register(XAJAX_FUNCTION, 'clickCreatePayInstallation');
	 
	$xajax -> processRequest(); 
	 
	$xajax -> configure('javascript URI','../../../utilities/xajax/');
	
	function clickCreatePayInstallation($payInstallation) {
		$GLOBALS['debug']->log("Entro a la funcion para llamar al presentador en la vista installation");
		$presenterPayInstallation = new PresenterPayInstallation();
		$GLOBALS['debug']->log("salida de haber llamado al presentador installation");
		$payInstallationCreation = $presenterPayInstallation -> clickCreatePayInstallation($payInstallation);
		$GLOBALS['debug']->log($payInstallationCreation,"terminada la ejecucion del presentador  installation");
		$response = new xajaxResponse();
		
		if ($payInstallationCreation == false)
			$response -> assign("transactionResult", "innerHTML", 
				'<font size="+1" color="#FF0000">La operaci&oacute;n fall&oacute;</font>');
		
		else
			$response -> assign("transactionResult", "innerHTML", 
				'<font size="+1" color="#006600">Operaci&oacute;n exitosa</font>');
		
		return $response;
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Registre pago Instalacion</title>
<?php 
	$xajax->printJavascript("../../../utilities/xajax/"); 
?>
<link rel="stylesheet" type="text/css" href="../css/formsStyles.css"/>
<link rel="stylesheet" type="text/css" href="../css/styles2.css" />
<!--Hoja de estilos del calendario -->
<link rel="stylesheet" type="text/css" media="all" href="../jscalendar/calendar-blue.css" title="win2k-cold-1" />

<!-- librería principal del calendario -->
<script type="text/javascript" src="../jscalendar/calendar.js"></script>

<!-- librería para cargar el lenguaje deseado -->
<script type="text/javascript" src="../jscalendar/lang/calendar-es.js"></script>

<!-- librería que declara la función Calendar.setup, que ayuda a generar un calendario en unas pocas líneas de código -->
<script type="text/javascript" src="../jscalendar/calendar-setup.js"></script> 

<!-- include the Tools -->
<script src="http://cdn.jquerytools.org/1.2.6/full/jquery.tools.min.js"></script>

</head>
<body>
	<div id="formsContainer">
        <div id="title">Resgitro Pago de Instalacion</div><br />
        <form name="payInstallation" id="payInstallation">
            <table class="formTable" cellspacing="0" cellpadding="5">
                <tr class="even">
                   <td align="right">Nombre</td>
                    <td align="left">
                        <input type="text" id="nameInstallation" name="nameInstallation" size="30" 
                        	maxlength="30" />
                    </td>
                </tr>
                <tr class="odd">
                    <td align="right">Monto</td>
                    <td align="left">
                    <input type="text" id="amountInstallation" name="amountInstallation" size="30" 
                        	maxlength="30" />
                    </td>
              </tr>
                
                <tr class="even">
                   <td align="right">Numero</td>
                    <td align="left">
                        <input type="text" name="numberInstallation" size="30" maxlength="17" />
                    </td>
                  
                </tr>
                       
               <tr class="even">
                    <td align="right">Fecha</td>
                    <td align="left">
                        <input type="text" id="installationDate" name="installationDate" 
                        	readonly="readonly" size="32" />&nbsp;
                        <input type="button" id="installationDateLauncher" value="..." />
                  
                </tr>
                       

            </table>
            
            <div id="transactionResult" align="center"></div>
            
            <br /><div id="buttons" align="center">
            	<input type="button" name="buttonCreateInstallation" value="Registrar" onclick="xajax_clickCreatePayInstallation(xajax.getFormValues('payInstallation'))" />
                 <input type="reset" name="clear" value="Borrar" onclick="" /> 
            </div>
        </form>
    </div>
      <!-- script que define y configura el calendario-->
    <script type="text/javascript">
    	Calendar.setup({
			inputField:"installationDate",
			ifFormat:"%Y-%m-%d",
			button:"installationDateLauncher"
		});
    </script> 
</body>
</html>